<template>
	<view class="page">
		<view class="title">
			5.7.安装插件unplugin-auto-import自动导入vue和uniapp模块
		</view>
		<view class="p">
			官网链接API
			<uni-link href="https://blog.csdn.net/qq_18798149/article/details/134321097" text="实现从vue模块中自动导入"
				color="#007BFF"></uni-link>
		</view>
		<view class="p">
			1.在项目命令行终端中执行如下代码
			<text selectable>
				npm install unplugin-auto-import
			</text>
		</view>
		<view class="p">
			2.根目录下创建vite.config.js，并拷贝下面的代码
			<text selectable>
				import { defineConfig } from 'vite'
				import uni from '@dcloudio/vite-plugin-uni'
				import AutoImport from 'unplugin-auto-import/vite'

				export default defineConfig({
				plugins: [
				uni(),
				// 自动导入配置
				AutoImport({
				imports:[
				// 预设
				'vue',
				'uni-app'
				]
				})
				]
				})
			</text>
		</view>
		<view class="p">
			完工
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
</script>

<style lang="scss" scoped>

</style>